﻿// DigitalDesign
// Project: InformationBoard
// Developer: Montak Oleg
// Created: 14.11.2011
// Last change: 16.11.2011
// Description: wrapper-classes for transfer to an entity on the client

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Server
{
    [DataContract]
    public class wScheduleNode
    {
        public wScheduleNode()
        {
            Location = new wLocation();
            DaysOfWeek = new List<wDayOfWeek>();
        }

        public wScheduleNode(Schedule schedule)
        {
            Id = schedule.Id;
            Location = new wLocation(schedule.Location);
            DaysOfWeek = new List<wDayOfWeek>();
            foreach (var day in schedule.DaysOfWeek)
            {
                DaysOfWeek.Add(new wDayOfWeek(day));
            }

            NumberOfTransport = schedule.NumberOfTransport;
            StationOfDestination = schedule.StationOfDestination;
            TimeOfDeparture = schedule.TimeOfDeparture;
            TimeOfLanding = schedule.TimeOfLanding;
            LocationId = Location.Id;
        }

        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public wLocation Location { get; set; }

        [DataMember]
        public TimeSpan TimeOfLanding { get; set; }

        [DataMember]
        public TimeSpan TimeOfDeparture { get; set; }

        [DataMember]
        public string StationOfDestination { get; set; }

        [DataMember]
        public string NumberOfTransport { get; set; }

        [DataMember]
        public List<wDayOfWeek> DaysOfWeek { get; set; }

        [DataMember]
        public int LocationId { get; set; }
    }
}
